//
//  HWzuixingHomePageTableViewCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2021/5/10.
//  Copyright © 2021 Chendaobin. All rights reserved.
//

#import "HWzuixingHomePageTableViewCell.h"

@implementation HWzuixingHomePageTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.title1Label.layer.borderColor = RGB(254, 106, 76).CGColor;
    self.title1Label.layer.borderWidth = 1;
    self.title1Label.textColor = RGB(253, 148, 80);
    
    
    self.title2Label.layer.borderColor = RGB(43, 102, 251).CGColor;
    self.title2Label.layer.borderWidth = 1;
    self.title2Label.textColor = RGB(55, 111, 250);
    
    
    self.title3Label.layer.borderColor = RGB(121, 54, 251).CGColor;
    self.title3Label.layer.borderWidth = 1;
    self.title3Label.textColor =  RGB(125, 59, 252);
    
    
    self.title1Label.hidden = YES;
    self.title2Label.hidden = YES;
    self.title3Label.hidden = YES;
    self.xiazaitubiaoico.hidden = YES;
    
    
    self.title1Label.layer.cornerRadius = 2;
    self.title1Label.layer.masksToBounds = YES;
    self.title2Label.layer.cornerRadius = 2;
    self.title2Label.layer.masksToBounds = YES;
    self.title3Label.layer.cornerRadius = 2;
    self.title3Label.layer.masksToBounds = YES;
    
    self.icoiamgetupianView.clipsToBounds = NO;
    
     
    self.qipaoImageView  = [[UIImageView alloc]initWithFrame:CGRectMake(48, -3, 21, 21)];
    self.qipaoImageView.image = [UIImage imageNamed:@"qipaotushezbi"];
    [self.icoiamgetupianView addSubview: self.qipaoImageView];
    
    
    
    UILabel *textlabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 21, 21)];
    textlabel.text = @"人气";
    textlabel.textAlignment =  NSTextAlignmentCenter;
    textlabel.textColor = RGB(255, 255, 255);
    textlabel.font = [UIFont systemFontOfSize:10];
    [self.qipaoImageView addSubview:textlabel];
    self.biaoqilabel = textlabel;
    
    [self.mingchengLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
    
    
    
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setDataModel:(HWGameListModel *)dataModel  {
    _dataModel = dataModel;
  
    [self.icoiamgetupianView  sd_setImageWithURL:[NSURL URLWithString:dataModel.icon] placeholderImage:nil];
    self.mingchengLabel.text = dataModel.name;
    self.pingfenLabel.text =  [NSString stringWithFormat:@"%@分",dataModel.point];
  
    
    self.fenleilabel.text  = [NSString stringWithFormat:@"%@    %@MB",dataModel.type,dataModel.size];
    
    
    for (int i = 0; i < dataModel.biaoqian.count; i++) {
        if (i == 0 ) {
            
            NSString *str1 =  dataModel.biaoqian[i];
                                                                  
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                                  
            self.kuandu1.constant = size.width+10;
    
            self.title1Label.hidden = NO;
            self.title1Label.text =  dataModel.biaoqian[i];
            
            
        } else if (i == 1) {
            
            
            NSString *str1 =  dataModel.biaoqian[i];
                                                       
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                       
            self.kuandu2.constant = size.width+10;
            
            
            self.title2Label.hidden = NO;
            self.title2Label.text =  dataModel.biaoqian[i];
                    
            
        }else {
            
                NSString *str1 =  dataModel.biaoqian[i];
                                              
                CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                              
                    self.kuandu3.constant = size.width+10;
            
            
              self.title3Label.hidden = NO;
             self.title3Label.text =  dataModel.biaoqian[i];
                   
                   
        }
        
        
      
            
    }
    
    
    
    
    
    
    
}


- (void)setFenleiModel:(HWGameListModel *)fenleiModel {
    
    
    _fenleiModel = fenleiModel;
    
    [self.icoiamgetupianView  sd_setImageWithURL:[NSURL URLWithString:fenleiModel.icon] placeholderImage:nil];
    self.mingchengLabel.text = fenleiModel.name;
    self.pingfenLabel.text =  [NSString stringWithFormat:@"%@分",fenleiModel.point];
  
    
    self.fenleilabel.text  = [NSString stringWithFormat:@"%@    %@MB",fenleiModel.fenlei,fenleiModel.size];
    
    
    for (int i = 0; i < fenleiModel.biaoqian.count; i++) {
        if (i == 0 ) {
            
            NSString *str1 =  fenleiModel.biaoqian[i];
                                                                  
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                                  
            self.kuandu1.constant = size.width+10;
    
            self.title1Label.hidden = NO;
            self.title1Label.text =  fenleiModel.biaoqian[i];
            
            
        } else if (i == 1) {
            
            
            NSString *str1 =  fenleiModel.biaoqian[i];
                                                       
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                       
            self.kuandu2.constant = size.width+10;
            
            
            self.title2Label.hidden = NO;
            self.title2Label.text =  fenleiModel.biaoqian[i];
                    
            
        }else {
            
                NSString *str1 =  fenleiModel.biaoqian[i];
                                              
                CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                              
                    self.kuandu3.constant = size.width+10;
            
            
              self.title3Label.hidden = NO;
             self.title3Label.text =  fenleiModel.biaoqian[i];
                   
                   
        }
        
        
      
            
    }
    
    
    
}


-(void)setLikeModel:(HWGameListModel *)likeModel {
    
        _likeModel = likeModel ;
    
    
    
    [self.icoiamgetupianView  sd_setImageWithURL:[NSURL URLWithString:likeModel.icon] placeholderImage:nil];
    self.mingchengLabel.text = likeModel.name;
    self.pingfenLabel.text =  [NSString stringWithFormat:@"%@分",likeModel.point];
  
    
    self.fenleilabel.text  = [NSString stringWithFormat:@"%@    %@MB",likeModel.type,likeModel.size];
    
    
    for (int i = 0; i < likeModel.biaoqian.count; i++) {
        if (i == 0 ) {
            
            NSString *str1 =  likeModel.biaoqian[i];
                                                                  
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                                  
            self.kuandu1.constant = size.width+10;
    
            self.title1Label.hidden = NO;
            self.title1Label.text =  likeModel.biaoqian[i];
            
            
        } else if (i == 1) {
            
            
            NSString *str1 =  likeModel.biaoqian[i];
                                                       
            CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                                       
            self.kuandu2.constant = size.width+10;
            
            
            self.title2Label.hidden = NO;
            self.title2Label.text =  likeModel.biaoqian[i];
                    
            
        }else {
            
                NSString *str1 =  likeModel.biaoqian[i];
                                              
                CGSize size =   [WMUtil strName:str1 fontSize:[UIFont systemFontOfSize:11] boundingRectWithSize:CGSizeMake(1000, 20)];
                                              
                    self.kuandu3.constant = size.width+10;
            
            
              self.title3Label.hidden = NO;
             self.title3Label.text =  likeModel.biaoqian[i];
                   
                   
        }
        
        
      
            
    }
    
    
    
    
}

@end
